package com.zh.kotlin_mvvm.ftp;

import android.content.ContentResolver;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.SparseArray;

import com.tencent.smtt.utils.Md5Utils;
import com.zh.common.utils.ZSpUtils;
import com.zh.kotlin_mvvm.MyApp;


public class XGConstant {

    public static  boolean isShowDouYouOpen = true;//用于豆油 app 开关的控制; true:为打开豆油显示jp完整功能；false：为只显示豆油解说

    public static String userSeeVideoId = "";//用户在看的电影，切当时并未打开下载界面过
    public static String BaseUrl = "http://anan.client51.com:8088/v2/";
    public static String AdUrl = BaseUrl + "ad.asp";
    public static final String InputEditexFilter = "[^a-zA-Z0-9\\u4E00-\\u9FA5_:：，,.。·?？!！\\s]";
    public static boolean hasNewMSg = false;
    public static boolean splasgHasAd = false, videoInfoHasAd = false, recommendHasAd = false,
            SearchHasAd = false, playBeforeHasAd = false, commentHasAd = false,
            UserCenterHasAd = false, StopPlayHasAd = false, Narrate_videoAd = false, NewUi_Slide = false, Video_TopAd = false;
//    public static List<NewAdResponse.Info> videoInfoAd, recommendAd, SearchAd;
    public static boolean hasMobileNetDownload = false;
    public static boolean isDarkMode = true;
    public static boolean hasChangeUserSave;
    public static int NET_Type = 0;//1=wifi,2=手机流量，0=无网络
    public static boolean hasChangeDownloadLsitData;//用户删除了下载视频
    //数据库的名称
    public static String DB_Table_Video = "videodb.db";//LS:本地视频 数据库


    //网页资源
    public static String Main_Menu_down = "Main_Menu_down";//下载
    public static String Main_Menu_net = "Main_Menu_net";//资源

    public static String Search_Word = "Search_Word";//搜索

    public static String Tou_Ping = "Tou_Ping";//投屏
    public static String quan_screen = "full_screen_play";//全屏


    public static String Check_ID_Movie18 = "1";//id：18 电影


    public static String Sort_Default = "update";//

    public static boolean Check_TuiJian = false;//是否是推荐的数据
    public static String ShowGuideEvent = "ShowGuideEvent";
    public static String CheckUpdateSize = "CheckUpdateSize";
    public static final String AD_BANNER_ID = "10621";//

    public static final String AD_RECT_VIDEO_ID = "10626";//

    public static SparseArray<String> commentColor;
    public static boolean Show_AD_By_SDK = true;

    //TJ:5.17友盟点击统计/
    public static void AddYOuMengs(String getaddStrs) {
   }



    //屏幕大小和状态栏
    public static int Screen_Width;
    public static int Screen_Height;
    public static int Screen_Status_Height;
    //=============   跳转传参标识  ================/
    //传列表数据键
    public static String KEY_LIST_DATA = "KEY_LIST_DATA";
    //传单个数据键
    public static String KEY_DATA = "KEY_DATA";
    //传单个数据键2
    public static String KEY_DATA_2 = "KEY_DATA_2";
    //传单个数据键3
    public static String KEY_DATA_3 = "KEY_DATA_3";
    //Album 传递数据
    public static String AlbumKeyId = "AlbumKeyId";
    //=============   跳转传参标识 End  ================/

    //用户信息
//    public static UserInfo userInfo;

    //是否有新的版本
    public static boolean HasNewVersion;


    //是否初始化P2P
    public static boolean hasInitP2p = false;

    //是否清除缓存，通知下载管理更新内存大小
    public static boolean showSDSizeByUserClear = false;

    //网页打开视频
    public static String urlVideoId;

    //U_Push
    public static int u_video_id = 0;

    //Service QQ
    public static String Default_SERVICE_QQ = "85723105";

    //    definition    清晰度 1.高清 2.普清 3.热门
    public static String getDefinition(int type) {
        String getMsg = "";
        if (type == 1) {
            getMsg = "高清";
        } else if (type == 2) {
            getMsg = "普清";
        } else if (type == 3) {
            getMsg = "热门";
        } else {
            getMsg = "";
        }
        return getMsg;
    }
    //官方评论 加载的时候； 底部不在显示内容
    public static String GUAN_FANG_COMMENT = "GUAN_FANG_COMMENT";
    public static String DOWN_AD_IN_OR_OUT = "1"; //安卓广告下载开关控制 1:代表走内部jp下载；0:代表走外部 也就是手机默认的浏览器下载打开方式


    //code   新添加判断是否新安装用户的参数code 后台处理逻辑
    public static String NEW_ADD_CODE = "code";
    public static String NEW_ADD_CHANNEL = "channel";

    //  code 对应的设备唯一码
    public static String GET_DEVICE_ID() {
        if (ZSpUtils.INSTANCE.getString(SpKey.KEY_IDENTIFIER_CODE) != null && !ZSpUtils.INSTANCE.getString(SpKey.KEY_IDENTIFIER_CODE).equals("")) {
            return ZSpUtils.INSTANCE.getString(SpKey.KEY_IDENTIFIER_CODE);
        } else {
            String mIdentifierCode;
            mIdentifierCode = ZSpUtils.INSTANCE.getString(SpKey.KEY_IDENTIFIER_CODE);
            if (TextUtils.isEmpty(mIdentifierCode)) {
                String SerialNumber = android.os.Build.SERIAL;
                ContentResolver contentResolver = MyApp.getInstance().getContentResolver();
                String Id = Settings.Secure.getString(contentResolver, Settings.Secure.ANDROID_ID);
                mIdentifierCode = Md5Utils.getMD5(SerialNumber + Id);//这里做了修改
                if (mIdentifierCode.length() > 32) {
                    mIdentifierCode = mIdentifierCode.substring(0, 32);
                }
                ZSpUtils.INSTANCE.put(SpKey.KEY_IDENTIFIER_CODE, mIdentifierCode);
            }

            return mIdentifierCode;
        }

    }
}
